package com.xuanyue.db.xuan.core.index;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;


public class ColumnValueFileCache {

	private RandomAccessFile data;
	private File file;
	public void init(File file) {
		this.file=file;
	}
	public void open() throws FileNotFoundException {
		data = new RandomAccessFile(file, "rws");
	}
	public void seek(long seek) throws IOException {
		data.seek(seek);
	}
	public int readInt() throws IOException {
		return data.readInt();
	}
	public long readLong() throws IOException {
		return data.readLong();
	}
	public float readFloat() throws IOException {
		return data.readFloat();
	}
	public void write(int v) throws IOException {
		data.writeInt(v);
	}
	public void write(float v) throws IOException {
		data.writeFloat(v);
	}
	public void write(long v) throws IOException {
		data.writeLong(v);
	}
	public void close() throws IOException {
		data.close();
		file.delete();
	}
}
